//
//  AULoginModule.swift
//  AwesomeULoginModule
//
//  Created by Miss_Special on 2018/4/28.
//

import UIKit
import AwesomeUSharedModule

public class AULoginModule {
    
    /// 登陆VC
    public var loginVC: UIViewController {
        get {
            let loginVC = AULoginViewController()
            return loginVC
        }
    }
    
    /// 单例
    public static let sharedLoginModule = AULoginModule()
    private init() { }
}

extension AULoginModule {
    
    /// bundle中读取图片资源
    static func imageFromBundle(bundle: Bundle, imageName: String, type: String = "png") -> UIImage? {
        if let bundleDict = bundle.infoDictionary {
            let bundleName = bundleDict["CFBundleName"] ?? ""
            if let imagePath = bundle.path(forResource: imageName, ofType: type, inDirectory: "\(bundleName).bundle") {
                if let image = UIImage(contentsOfFile: imagePath) {
                    return image
                }
            }
        }
        return nil
    }
}
